import { PlanImpleApi } from '@/api'
import CommonModel from './common'

class PlanImpleModel extends CommonModel {
    constructor() {
        super()
        this.api = new PlanImpleApi()
    }

    // 基础详情
    detail(data, filter) {
        return this.api.detail(data).then(res => {
            if (filter) {
                const result = this.transformNull(res)
                return result
            }
            return res
        })
    }

    // 获取日常详情
    getEverydayDetail(number, filter) {
        const data = { number }
        return this.api.getEverydayDetail(data).then(res => {
            if (filter) {
                const result = this.transformNull(res)
                return result
            }
            return res
        })
    }

    // 获取专项工程详情
    getSpecialDetail(number, filter) {
        const data = { number }
        return this.api.getSpecialDetail(data).then(res => {
            if (filter) {
                const result = this.transformNull(res)
                return result
            }
            return res
        })
    }

    // 获取月度计划下拉列表
    getPlanList(data) {
        return this.api.getPlanList(data)
    }

    // 提交
    submit(number) {
        const data = { number }
        return this.api.submit(data)
    }

    // 撤回
    recall(number) {
        const data = { number }
        return this.api.recall(data)
    }
}

export default PlanImpleModel
